/**
 * 
 */
package metalink.admin;

import java.util.ArrayList;

import vo.LibraryBookDetailsVo;
import model.admin.LibraryMo;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Sony
 * 
 */

public class ListBooks extends ActionSupport {
	ArrayList<LibraryBookDetailsVo> allBooks;
	String view,category,book_id;


	public String execute() {
		setView(view);
		setCategory(category);
		if (view.equals("category")) {
			LibraryMo mo = new LibraryMo();
			allBooks = new ArrayList<LibraryBookDetailsVo>();
			allBooks = mo.bookList();
			return SUCCESS;
		} else if (view.equals("books")) {
			LibraryMo mo = new LibraryMo();
			allBooks = new ArrayList<LibraryBookDetailsVo>();
			allBooks = mo.allBooksList(category);
			return SUCCESS;
		}
		else if (view.equals("all")) {
			LibraryMo mo = new LibraryMo();
			allBooks = new ArrayList<LibraryBookDetailsVo>();
			allBooks = mo.allBooks();
			return SUCCESS;
		}
		return SUCCESS;
	}



	public String getBook_id() {
		return book_id;
	}



	public void setBook_id(String book_id) {
		this.book_id = book_id;
	}



	public String getCategory() {
		return category;
	}



	public void setCategory(String category) {
		this.category = category;
	}


	public ArrayList<LibraryBookDetailsVo> getAllBooks() {
		return allBooks;
	}



	public void setAllBooks(ArrayList<LibraryBookDetailsVo> allBooks) {
		this.allBooks = allBooks;
	}



	public String getView() {
		return view;
	}

	public void setView(String view) {
		this.view = view;
	}

}
